MaplePrimes Questions

Search Questions:

Investigate the conditions under which the system admits a  Zero–Hopf bifurcation, approximate the existence of limit cycles.

Can the first-order averaging method approximate periodic solutions near resonance conditions?

Show the existence of a limit cycle  in 3D projection (x,y,z).

jerk_Av1.mw

 

I feel that it is increasingly common for answers to generate no reaction from their authors.

Perhaps the author simply voted up... but in that case, would it be possible to indicate this (something like "XXX voted up")? 

This would avoid wasting time responding to the same author in the future, as it doesn't seem to care about commenting the answer.

I want to load some specific constants at the beginning of my document. I load the ScientificConstants package first. Then I use a list of names of the constants I need. But the assignation in the loop does not work. Only the value and the units appear in the list, but they are not assigned to the letter. See the document included for more details.   Using_the_constants_.mw

Thank you in advance for your help

Mario


I would like to find the indeterminates of the following expression:

K:=2*x+I*y/Pi+Catalan*5-g(infinity)+f(undefined);

# I expect to get x an y.

indets(K,And(name,Not(constant)));
# answer: {x, y, undefined} I surprised at undefined.

indets(K,'name &under evalf');
#answer {x, y} it is correct.

I am optimizing an objective function subject to two constraints. I have obtained the solution, but I am unsure how to determine the conditions for the Lagrange multipliers μ1​ and μ2​. For example, using the KKT conditions, if μ1>0 then the solution is X, and if μ2>0 then the solution is Y. Could you guide me on how to find μ1 and μ2 along with their corresponding conditions?

restart

with(Optimization); with(plots); with(LinearAlgebra)

_local(Pi)

Pi

(1)
 

`π_m` := proc (i1) options operator, arrow; (w-i1)*(1/2+(1/2)*(i1-i2)/tau)*(1-(Pn-Pr)/(1-delta))-C0-(1/2)*Cr*(1/2+(1/2)*(i1-i2)/tau)^2*(1-(Pn-Pr)/(1-delta))^2+Ce*rho0*(1-(Pn-Pr)/(1-delta)) end proc

C1 := (2*rho0-1)*tau+i2 <= i1

(2*rho0-1)*tau+i2 <= i1

(2)

C2 := i1 <= tau+i2

i1 <= tau+i2

(3)

NULL

NULL

``

NULL

# No equality constraints
#
# Inequality constraints must be of the form f[i](i1) <= 0
#
# Thus
#
# (1) For C1
#     so
      f[1] := (i1) -> (2*rho0 - 1)*tau + i2-i1:
      
#
# (2) C2
#     so
      f[2] := (i1) -> i1-(tau + i2):
      
#

# Lagrangian (we want to maximize `&pi;_m` so to minimize -`&pi;_m`

L := -`&pi;_m`(i1) + add(f[i](i1)*mu[i], i=1..2):

dLdi1 := collect(diff(L, i1), [i1]):

KKT_conditions := [
                    seq(mu[i] >= 0, i=1..2),         # Dual feasibility conditions
                    dLdi1 = 0,                       # Stationarity condition
                    seq(``(f[i](i1)) <= 0, i=1..2),  # Primal feasibility conditions
                    add(mu[i]*f[i](i1) = 0, i=1..2)  # Complementary slackness
                  ]:

print~(KKT_conditions);

0 <= mu[1]

 

0 <= mu[2]

 

((1-(Pn-Pr)/(1-delta))/tau+(1/4)*Cr*(1-(Pn-Pr)/(1-delta))^2/tau^2)*i1+(1/2-(1/2)*i2/tau)*(1-(Pn-Pr)/(1-delta))-(1/2)*w*(1-(Pn-Pr)/(1-delta))/tau+(1/2)*Cr*(1/2-(1/2)*i2/tau)*(1-(Pn-Pr)/(1-delta))^2/tau-mu[1]+mu[2] = 0

 

``((2*rho0-1)*tau+i2-i1) <= 0

 

``(i1-tau-i2) <= 0

 

((2*rho0-1)*tau+i2-i1)*mu[1]+(i1-tau-i2)*mu[2] = 0

 

[]

(4)


Analysis of dLdp1

with(LargeExpressions):

DLDi1 := collect(dLdi1, i1, Veil[K]);

(1/4)*K[1]*i1-(1/4)*K[2]

(5)

# Thus dLdi1 = 0 verifies

isolate((5), i1)
 

i1 = K[2]/K[1]

(6)

# Where K1 and K2 are

i := 'i':
KS := [ seq(K[i] = Unveil[K](K[i]), i=1..LastUsed[K] ) ];

[K[1] = (-1+delta+Pn-Pr)*(Cr*Pn-Cr*Pr+Cr*delta+4*delta*tau-Cr-4*tau)/(tau^2*(-1+delta)^2), K[2] = (4*delta^2*tau^2*mu[1]-4*delta^2*tau^2*mu[2]+Cr*Pn^2*i2-Cr*Pn^2*tau-2*Cr*Pn*Pr*i2+2*Cr*Pn*Pr*tau+2*Cr*Pn*delta*i2-2*Cr*Pn*delta*tau+Cr*Pr^2*i2-Cr*Pr^2*tau-2*Cr*Pr*delta*i2+2*Cr*Pr*delta*tau+Cr*delta^2*i2-Cr*delta^2*tau+2*Pn*delta*i2*tau-2*Pn*delta*tau^2+2*Pn*delta*tau*w-2*Pr*delta*i2*tau+2*Pr*delta*tau^2-2*Pr*delta*tau*w+2*delta^2*i2*tau-2*delta^2*tau^2+2*delta^2*tau*w-8*delta*tau^2*mu[1]+8*delta*tau^2*mu[2]-2*Cr*Pn*i2+2*Cr*Pn*tau+2*Cr*Pr*i2-2*Cr*Pr*tau-2*Cr*delta*i2+2*Cr*delta*tau-2*Pn*i2*tau+2*Pn*tau^2-2*Pn*tau*w+2*Pr*i2*tau-2*Pr*tau^2+2*Pr*tau*w-4*delta*i2*tau+4*delta*tau^2-4*delta*tau*w+4*tau^2*mu[1]-4*tau^2*mu[2]+Cr*i2-Cr*tau+2*i2*tau-2*tau^2+2*tau*w)/(tau^2*(-1+delta)^2)]

(7)


Analysis of the two constraints

beta

beta

(8)

Cs := { seq(beta[i] = subs(i1=0, f[i](i1)), i=1..2) };

{beta[1] = (2*rho0-1)*tau+i2, beta[2] = -tau-i2}

(9)

 

# two constraints problem

Cmin_value := min(rhs~(Cs));  # the "true" constraints
Cmax_value := max(rhs~(Cs)):

Cmin_name  := min(lhs~(Cs));  # the "abstract" constraints
Cmax_name  := max(lhs~(Cs)):

Cmin_name  := LowerBound;  # and an even more abstract form
Cmax_name  := UpperBound:

Complementary_Slackness := mu[1]*(Cmin_name-i1) , mu[2]*(i1-Cmax_name);

L2     := -`&pi;_m`(i1) + add(Complementary_Slackness):
dL2di1 := diff(L2, i1):
dL2di1 := map(simplify, %, size);
 

min(-tau-i2, (2*rho0-1)*tau+i2)

 

min(beta[1], beta[2])

 

LowerBound

 

mu[1]*(LowerBound-i1), mu[2]*(i1-UpperBound)

 

(1/2)*(tau+i1-i2)*(-1+delta+Pn-Pr)/(tau*(-1+delta))+(1/2)*(-w+i1)*(-1+delta+Pn-Pr)/(tau*(-1+delta))+(1/4)*Cr*(tau+i1-i2)*(-1+delta+Pn-Pr)^2/(tau^2*(-1+delta)^2)-mu[1]+mu[2]

(10)

type(dL2di1, linear([i1, seq(mu[i], i=1..2)]));

SC_CS_sols := solve(
  {
    dL2di1 = 0,
    op([Complementary_Slackness] =~ 0)
  }
  ,
  {i1, seq(mu[i], i=1..2)}
):

true

 

Main: Entering solver with 3 equations in 3 variables
Main: attempting to solve as a linear system
Main: attempting to solve as a polynomial system
Main: Polynomial solver successful. Exiting solver returning 1 solution

 

# How many solutions did we get?

numelems([SC_CS_sols]);

# And those solutions are charecterized by

map(s -> if eval(lambda[1], s) = 0 then
           if eval(lambda[2], s) = 0 then
             "i1 belongs to interval (LowerBound, UpperBound)"
           else
             "i1 is equal to the UpperBound"
           end if
         else
           "i1 is equal to the LowerBound"
         end if
         , [SC_CS_sols]);

# So we get as expected the three possible situations.

3

 

["i1 is equal to the LowerBound", "i1 is equal to the LowerBound", "i1 is equal to the LowerBound"]

(11)

Cmin_value

min(-tau-i2, (2*rho0-1)*tau+i2)

(12)
 

 

Download I_1_Optimum_condition.mw

in here  for jacobieliptic i got two lambda[0] same as paper did but in second one is different and is true make my ode be zero, but is so different from paper 

test-Dr.D.mw

In this maple file i try to find normal form and limit cycle of this jerk system but l don't know find like a paper did?

av.mw

DrawGraph(Graph({[{1, 2}, 0.7462761011], [{2, 3}, 0.8190708767], [{2, 4}, 0.6810933318], [{4, 5}, 0.7451261104], [{4, 23}, 0.6746390886], [{5, 6}, 0.7231256359], [{6, 7}, 0.6775594149], [{6, 10}, 0.7019893588], [{7, 8}, 0.6618796622], [{7, 9}, 0.6623496808], [{8, 9}, 0.6688297164], [{10, 11}, 0.7092623872], [{10, 22}, 0.7112560850], [{11, 12}, 0.7098970677], [{12, 13}, 0.7108845941], [{12, 19}, 0.7092202631], [{13, 14}, 0.6734297238], [{13, 18}, 0.6767541419], [{14, 15}, 0.6466191140], [{15, 16}, 0.6773709292], [{16, 17}, 0.6780410682], [{17, 18}, 0.6468993314], [{19, 20}, 0.7444847640], [{19, 21}, 0.7192676187], [{21, 22}, 0.7167453581], [{22, 23}, 0.6726943362], [{23, 24}, 0.8156746068]}), layout = spring)

DrawGraph and save that as 300 dpi png increase edge length so that the edge weight show up How do the edge are small sized and weights overlap and and are not neatly seen in the middle of edge without overlap kind help with a code to correct this

Why can't Maple compare two identical matrices or vectors?

Hi there.

There is an issue with following limits in Maple 2025:

Maple returned an incorrect zero answers. Plotting functions we see that non-zero limits do exist:

Thank you.

limits.mw

Another very serious bug in Maple.

I have code that simplifies intitial conditions passed.

I found that simplify((D@@2)(y)(Pi) = 0) gives error 

Error, (in unknown) invalid input: diff received Pi, which is not valid for its 2nd argument

but Pi is constant. It works for any other values other than Pi.

This only happens when adding Physics:-Setup(assumingusesAssume = true):

Any idea why this happens?

restart;

interface(version);

`Standard Worksheet Interface, Maple 2025.1, Linux, June 12 2025 Build ID 1932578`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1877 and is the same as the version installed in this computer, created 2025, July 11, 19:24 hours Pacific Time.`

SupportTools:-Version();

`The Customer Support Updates version in the MapleCloud is 29 and is the same as the version installed in this computer, created June 23, 2025, 10:25 hours Eastern Time.`

simplify((D@@2)(y)(Pi) = 0)

((D@@2)(y))(Pi) = 0

Physics:-Setup(assumingusesAssume = true):

simplify((D@@2)(y)(Pi) = 0)

Error, (in unknown) invalid input: diff received Pi, which is not valid for its 2nd argument

 

 

Download simplify_fail_when_adding_physics_sept_27_2025.mw

I am interested in determining the density function which results from multiplying two random variables.  I have read about the Mellin Transformation, but I just end up confused.  I have two random variables:  f[1], which is nonzero on the 0 < t < 2 interval, and f[2], which is nonzero on the 0 < t < 1 interval.  Of course, both of these random variables sum to one when evaluated.

Any thoughts on how I can obtain the density function for this?  My work is below.

restart

with(Statistics)

f[1] := piecewise(t <= 0, 0, 0 < t and t < 2, 1/(Pi*sqrt(1-(1-t)^2)), t >= 2, 0)

piecewise(t <= 0, 0, 0 < t and t < 2, 1/(Pi*(1-(1-t)^2)^(1/2)), 2 <= t, 0)

f[2] := piecewise(t <= 0, 0, 0 < t and t < 1, 2*t, t >= 1, 0)

piecewise(t <= 0, 0, 0 < t and t < 1, 2*t, 1 <= t, 0)


Download Inquiry.mw

...but it's easily solvable with the help of a trick. My main concern is the path to the solution for the attached Diophantine equation. I was able to solve the problem both with pen and paper and then in Maple. There's certainly a more elegant way. I'm particularly interested in a special Maple command. However, I don't want to ask for it here yet, as it would give a hint of the trick and spoil the fun of solving the puzzle.

 

419*x^2+116*x*y-426*x*z+78*y^2-142*y*z+133*z^2-1604*x-682*y+1086*z+2306 = 0

NULL

Download Diophant.mw

in here i want the system which when i found the system it contain a singularity but by some changing of system we can remove it, i know how he did that but i can't do it by coding, also after removing which i did by hand , there is another problem which equalibruiom points is to long how i can make it be shorter becuase contain two function i don't know how do that can i change the coiefecient of any function by another letter? also for phase portrait i need `conserved quantity` which last code is not work for finding this kind of system ? and how decide about jacobian if the `conserved quantity` is know by that after determine the points it will be clear on plots, i write the code untill finding the `conserved quantity` becuase code not run i didn't find jacobian and phase portrait but i will put the code of jacobian and phase portrait too! 

bi-1.mw

Even though I missed the reference to "algebraic number of type a+b*sqrt(13)" in the solutions to the previous problem, here's another puzzle from school:
Let p and q be prime numbers. Show that there are infinitely many prime numbers such that p^2 - q^2 is divisible by 24.

1 2 3 4 5 6 7 Last Page 1 of 2433